home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / manchest.lha / MANCHESTER / usenet / st80_pre4 / file-fixes.st < prev    next >
Text File  |  1993-07-24  |  3KB  |  106 lines

  1. "    NAME        file-fixes
  2.     AUTHOR        holdam@daimi.UUCP (Jan Holdam)
  3.     FUNCTION    UnixFileList - problems and solutions
  4.     ST-VERSION    2.1
  5.     PREREQUISITES    
  6.     CONFLICTS
  7.     DISTRIBUTION    world
  8.     VERSION        1
  9.     DATE    12 Jan 1987
  10. SUMMARY Description of problems with UnixFileLists and solutions.
  11. "
  12. '
  13. Newsgroups: comp.lang.smalltalk
  14. Subject: UnixFileList - problems and solutions
  15. Message-ID: <503@daimi.UUCP>
  16. Organization: DAIMI: Computer Science Department, Aarhus University, Denmark
  17.  
  18. We have discovered some minor problems with the UnixFileList-browser.
  19. One of them was that it was not possible to read files from
  20. a directory with a name of a reasonable length (greater than 30).
  21. The change to the method open in class UnixFileList
  22. solves this problem.
  23.  
  24. The other problem was that you could not scroll the contents
  25. of the OnlyWhenSelectedCodeView when it was showing a directory.
  26. The change to the method text in the same class is a solution to this.
  27.  
  28. We have another problem which we haven''t found a solution to.
  29. We are running PS-Smalltalk on Sun 3''s, and if you push the Caps Lock
  30. button on the keyboard, every keystroke is translated into an uppercase
  31. X. This is not very useful, so if anyone has a solution to the problem,
  32. or some hints where to look we would be grateful.
  33.  
  34. Jan Holdam
  35. Department of Computer Science
  36. Aarhus University
  37. DK-8000 Aarhus C
  38. Denmark
  39.  
  40. UUCP: holdam@daimi.UUCP or ..!!mcvax!!diku!!daimi!!holdam
  41. '
  42.  
  43. 'From Smalltalk-80, version 2, of April 1, 1983 on 16 September 1986 at 3:21:43 pm'!
  44.  
  45.  
  46.  
  47. !UnixFileList class methodsFor: 'instance creation'!
  48.  
  49. open        "UnixFileList open"
  50.     "Create and schedule a view of a new
  51.      instance of me on the current working directory."
  52.     "Changed by Jan Holdam"
  53.  
  54.  
  55.     | cwd size |
  56.     cwd _ String new: 150. "Was 30"
  57.     size _ (UnixSystemCall getWorkingDirectoryInto: cwd) value.
  58.     ^self openOn: (cwd copyFrom: 1 to: size)! !
  59.  
  60.  
  61. 'From Smalltalk-80, version 2, of April 1, 1983 on 27 November 1986 at 1:11:31 pm'!
  62.  
  63.  
  64.  
  65. !UnixFileList methodsFor: 'text'!
  66.  
  67. text
  68.     | text dirList dirStream |
  69.     isDirectory
  70.         ifTrue: [
  71.             emptyDir
  72.                 ifFalse: [text _ '-Directory is not empty, cannot be removed. -'
  73.                                  asText emphasizeFrom: 2 to: 43 with: 3]
  74.                 ifTrue: [dirList _ SortedCollection new.
  75.                     dirStream _ WriteStream on: (String new).
  76.                     dirStream nextPutAll: ('-directory -'); cr; cr.
  77.                     dirList addAll: ((UnixFileDirectory named: selectionName) filesMatching: '*').
  78.                     dirList do: [ :name | dirStream nextPutAll: name; cr].
  79.                     text _ dirStream contents asText emphasizeFrom: 2 to: 11 with: 3.
  80.                     isReading _ true "to make scrolling in directories possible/jh/861127"]]
  81.         ifFalse: [ "Then it is a file."
  82.             isReading
  83.                 ifTrue:
  84.                     [fileName == nil ifTrue: [^nil].
  85.                     (UnixFileDirectory includesKey: fileName)
  86.                         ifTrue: [text _ Cursor read showWhile:
  87.                             [(FileStream fileNamed: fileName) contentsOfEntireFile asText].
  88.                             swap ifTrue: [text string swapCrLfs]]
  89.                         ifFalse:
  90.                             [text _ '-new file -' asText emphasizeFrom: 2 to: 10 with: 3]]
  91.                 ifFalse:
  92.                     [fileName == nil
  93.                         ifTrue:
  94.                             [text _ '' asText]
  95.                         ifFalse:
  96.                             [(UnixFileDirectory includesKey: fileName)
  97.                                 ifTrue:
  98.                                     [text _ '-file -  Select ''get contents'' to view contents. ' asText.
  99.                                     text emphasizeFrom: 2 to: 6 with: 3; emphasizeFrom: 10 to: text size with: 3]
  100.                                 ifFalse:
  101.                                     [text _ '-new file -' asText emphasizeFrom: 2 to: 10 with: 3.
  102.                                     isReading _ true.]]]].
  103.     ^text! !
  104.  
  105.  
  106.